package com.liang.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liang.entity.CWeiji;
import com.liang.mapper.CWeijiMapper;
import com.liang.service.CWeijiService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 李昂
 * @since 2020-11-30
 */
@Service
@CacheConfig(cacheNames = "CWeijiMapper")
public class CWeijiServiceImpl extends ServiceImpl<CWeijiMapper, CWeiji> implements CWeijiService {

    /**
     * @Author 李昂
     * @Description 根据学号查询违纪记录
     * @Date 2020/12/4 14:29
     */
    @Override
    @Cacheable(value = "weiji")
    public List<CWeiji> lookweiji(String sno) {
        return this.baseMapper.lookweiji(sno);
    }

    /**
     * @Author 李昂
     * @Description 录入违纪信息
     * @Date 2020/12/4 18:42
     */
    @Override
    @CacheEvict(value = "weiji", allEntries = true)
    public boolean insertWeiji(CWeiji weiji) {
        return this.save(weiji);
    }

    //删除违纪信息
    @Override
    @CacheEvict(value = "weiji", allEntries = true)
    public boolean deleteWeiji(int id) {
        return this.removeById(id);
    }


}
